home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bitstrg.zip / READ.ME < prev    next >
Text File  |  1989-06-05  |  5KB  |  189 lines

  1.  
  2.                                                     june 05, 1989
  3.                   Bit manipulation in C
  4.                        (bitstrg)
  5.  
  6.  
  7.     The archivees are :
  8.  
  9.         - sbitstrg.lib      library of the bit manipulation functions
  10.         - sbitstrg.pub      references to this library
  11.  
  12.         - bitstrg.h         The include file
  13.  
  14.         - bitstrg.c         The source file to test the bit
  15.                              manipulation functions (1 to 65536 bits)
  16.         - lbitstrg.c        The source file to test the bit
  17.                              manipulation functions (1 to xxxxxx bits)
  18.  
  19.         - *.c               The source files of all the functions
  20.                              (1 to 65536 bits)
  21.         - l*.c              The source files of all the functions
  22.                              (1 to xxxxxx bits)
  23.  
  24.         - cpbit.mk          The make file to generate the executable
  25.                              test for 1 to 65536 bits
  26.         - cplbit.mk         The make file to generate the executable
  27.                              test for 1 to xxxxxx bits
  28.  
  29.  
  30.     Compiler used : Microsoft C 5.1. Should be easily portable.
  31.  
  32.  
  33.  
  34.     The functions in the library are :
  35.  
  36. /*
  37.     Creation of an array of bit
  38.  
  39.     The array is initialized to all 0s
  40.     return a pointer on the array parameters structure or NULL if problem
  41. */
  42.  
  43. struct SPARRAY* crebitarray(nbbit)
  44.     unsigned nbbit;         /* number of the last bit in the array */
  45.  
  46.  
  47. /*
  48.     Clear bit array to all 0s
  49. */
  50.  
  51. void clrbitarray(ptr)
  52.     struct SPARRAY * ptr;       /* pointer on structure */
  53.  
  54. /*
  55.      declaration of a memory field as an array of bit
  56.  
  57.     return a pointer on the array parameters structure or NULL if problem
  58. */
  59.  
  60. struct SPARRAY* decarbit(ptr,nombr)
  61.     ELEBAR*     ptr;        /* pointer on the memory field */
  62.     unsigned    nombr;      /* number of elements in the field */
  63.  
  64. /*
  65.     invert state of specified bit
  66.  
  67.     if bit > map size, 0 is returned, else 1 is returned
  68. */
  69.  
  70. unsigned invertbit(ptr,bit)
  71.     struct SPARRAY * ptr;       /* pointer on structure */
  72.     unsigned    bit;            /* bit number */
  73.  
  74. /*
  75.     Set specified bit
  76.  
  77.     if bit > map size, 0 is returned, else 1 is returned
  78. */
  79.  
  80. unsigned setbit(ptr,bit)
  81.     struct SPARRAY * ptr;       /* pointer on structure */
  82.     unsigned    bit;            /* bit number */
  83.  
  84.  
  85. /*
  86.     Clear specified bit
  87. */
  88.  
  89. unsigned clearbit(ptr,bit)
  90.     struct SPARRAY * ptr;       /* pointer on structure */
  91.     unsigned    bit;            /* bit number */
  92.  
  93.  
  94. /*
  95.     Test specified bit
  96.  
  97.     return non zero if set, else return zero
  98. */
  99.  
  100. unsigned testbit(ptr,bit)
  101.     struct SPARRAY * ptr;       /* pointer on structure */
  102.     unsigned    bit;            /* bit number */
  103.  
  104.  
  105. /*
  106.     Restitution of the memory space of an array of bit
  107. */
  108.  
  109. void freebitarray(ptr)
  110.     struct SPARRAY * ptr;       /* pointer on structure */
  111.  
  112.  
  113. /*
  114.     Creation of an array of bit
  115.  
  116.     The array is initialized to all 0s
  117.     return a pointer on the array parameters structure or NULL if problem
  118. */
  119.  
  120. struct LSPARRAY* lcrebitarray(nbbit)
  121.     unsigned long    nbbit;     /* number of the last bit in the array */
  122.  
  123.  
  124. /*
  125.     Clear bit array to all 0s
  126. */
  127.  
  128. void lclrbitarray(ptr)
  129.     struct LSPARRAY * ptr;      /* pointer on structure */
  130.  
  131. /*
  132.      declaration of a memory field as an array of bit
  133.  
  134.     return a pointer on the array parameters structure or NULL if problem
  135. */
  136.  
  137. struct LSPARRAY* ldecarbit(ptr,nombr)
  138.     ELEBAR*     ptr;        /* pointer on the memory field */
  139.     unsigned    nombr;      /* number of elements in the field */
  140.  
  141. /*
  142.     invert state of specified bit
  143.  
  144.     if bit > map size, 0 is returned, else 1 is returned
  145. */
  146.  
  147. unsigned linvertbit(ptr,bit)
  148.     struct LSPARRAY * ptr;      /* pointer on structure */
  149.     unsigned long   bit;        /* bit number */
  150.  
  151.  
  152. /*
  153.     Set specified bit
  154.  
  155.     if bit > map size, 0 is returned, else 1 is returned
  156. */
  157.  
  158. unsigned lsetbit(ptr,bit)
  159.     struct LSPARRAY * ptr;      /* pointer on structure */
  160.     unsigned long   bit;        /* bit number */
  161.  
  162.  
  163. /*
  164.     Clear specified bit
  165. */
  166.  
  167. unsigned lclearbit(ptr,bit)
  168.     struct LSPARRAY * ptr;      /* pointer on structure */
  169.     unsigned long   bit;        /* bit number */
  170.  
  171.  
  172. /*
  173.     Test specified bit
  174.  
  175.     return non zero if set, else return zero
  176. */
  177.  
  178. unsigned ltestbit(ptr,bit)
  179.     struct LSPARRAY * ptr;      /* pointer on structure */
  180.     unsigned long   bit;        /* bit number */
  181.  
  182.  
  183. /*
  184.     Restitution of the memory space of an array of bit
  185. */
  186.  
  187. void lfreebitarray(ptr)
  188.     struct LSPARRAY * ptr;      /* pointer on structure */
  189.